Skip to main content

All Questions

2votes
2answers
209views

Why do some languages decouple operations from data type?

This is a pretty difficult question to frame. But I'll try my best. In some languages, data types are decoupled from the operations they can perform, while in other languages like JavaScript they are ...
scroobius's user avatar
2votes
2answers
496views

How to avoid generating verbose code when compiling from a higher level language to a lower one?

I apologize in advance for the vague title. I didn't want to make it overly verbose, so allow me to explain more in-depth below: I've currently been developing a strong, statically typed language ...
Chris's user avatar
  • 2,840
5votes
1answer
305views

In more canonical OO Python situations, what is the rule of thumb for default access modifiers?

Generally speaking in canonical OOP situations, the rule of thumb is to write your classes with the least access as necessary. i.e. only make public only what is necessary, make protected only what is ...
Trevor Boyd Smith's user avatar
3votes
4answers
2kviews

Design Pattern for Indirectly Connecting Two Classes

Admittedly, this is a homework problem but I have tried to figure it out on my own. Just want to make sure I get it correct. So far, the only design pattern I believe to be correct would be the ...
TacoB0t's user avatar
20votes
2answers
5kviews

How are generics implemented in a modern compiler?

What I mean here is how do we go from some template T add(T a, T b) ... into the generated code? I've thought of a few ways to achieve this, we store the generic function in an AST as Function_Node ...
Jon Flow's user avatar
-4votes
4answers
535views

Why aren't named switch statements a language feature? [closed]

I could imagine the below code being somewhat useful. Is there a reason this pattern hasn't made it into programming languages? To be clear the string was just what I chose as an example you could ...
Jack Fraser's user avatar
1vote
2answers
571views

How do you guard against hidden overflows

consider the following: (i+j)/2 i and j are both 32 bit integers and the result should also be. But in the little equation, there's a hidden overflow, i+j could become larger then a 32 bit integer ...
Pieter B's user avatar
-1votes
1answer
201views

All programming functions always return to the If or If/Else statement? [closed]

After learning, coding, and coding even more than ever now, I have noticed a trend in a lot of programming which I do. The trend is that the majority of my functions are if{} or if{} else{} statements ...
Traven's user avatar
1vote
1answer
154views

Optimizing mindmaps by finding the least amount of redundancy

When using mindmaps, you order them based on how you think it fits best. So for instance (tab means subtree) requirements dinner food forks spoons breakfast food forks this ...
Gewinn's user avatar
66votes
6answers
24kviews

Is an event loop just a for/while loop with optimized polling?

I'm trying to understand what an event loop is. Often the explanation is that in an event loop, you do something until you're notified that an event has occurred. You then handle the event and ...
TheMeaningfulEngineer's user avatar
1vote
9answers
1kviews

Finally block for methods - is it a bad idea?

The finally block for a try-catch structure is well known, and gives a really easy and elegant way to deal with some must-be-done code. Therefore, I can see no reason why It shouldn't be good for ...
Elist's user avatar
3votes
3answers
356views

MVC seems to create dependencies that just "don't feel right"

I might be misunderstanding MVC, so forgive me if that is the case. This is my program structure (Java/Swing): I have a JTable (View) that is pointed to by a custom linked list (Model). When the user ...
sinθ's user avatar
  • 1,311
13votes
1answer
2kviews

So, "Are Design Patterns Missing Language Features"? [closed]

I saw, here on Programmers, the answer to this question: How does thinking on design patterns and OOP practices change in dynamic and weakly-typed languages? There I found a link to an article with an ...
Eduard Florinescu's user avatar
5votes
2answers
3kviews

Design patterns and multiple programming languages

I am referring here to the design patterns found in the GOF book. First, how I see it, there are a few peculiarities to design pattern and knowing multiple languages, for example in Java you really ...
Eduard Florinescu's user avatar
12votes
8answers
2kviews

Why aren't design patterns added to the languages constructs?

Recently I was talking with a colleague who mentioned that his company was working on adding the MVC design pattern as a PHP extension. He explained that they wrote C code for adding Controllers, ...
Songo's user avatar
  • 6,663

153050per page
close